package com.intelligentcar.springboot.controller;


import com.intelligentcar.springboot.bean.Parameter;
import com.intelligentcar.springboot.bean.User;
import com.intelligentcar.springboot.service.UserServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
// 在加一个 @RequestMapping  成为二级路径
public class UserController {

    @Autowired
    private UserServer userServerImpl;

    @RequestMapping("/userTable")
    @ResponseBody
    public Map<String,Object> userTable(@RequestBody User user){
        return userServerImpl.userTable(user);
    }

//    @RequestMapping("/updateUser")
//    @ResponseBody
//    public boolean updateUser(@RequestBody User user){
//        return userServerImpl.updateUser(user);
//    }

    @RequestMapping("/updateUserState")
    @ResponseBody
    public boolean updateUserState(@RequestBody User user){
        return userServerImpl.updateUserState(user);
    }

//    @RequestMapping("/insertUser")
//    @ResponseBody
//    public boolean insertUser(@RequestBody User user){
//        return userServerImpl.insertUser(user);
//    }

    @RequestMapping("/selectUser")
    @ResponseBody
    public Map<String,Object> selectUser(@RequestBody User user){
        return userServerImpl.selectUser(user);
    }

    @RequestMapping("/resetPwd")
    @ResponseBody
    public boolean resetPwd(@RequestBody User user){
        return userServerImpl.resetPwd(user);
    }

}
